<?php
namespace app\admin\validate;

use think\Validate;

class User extends Validate
{
    // 验证规则
    protected $rule = [
        'tel' => ['require','regex'=>'/^1[34578]\d{9}$/'],
        'email' => ['require','regex'=>'^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'],
        'password' => ['require','alphaNum','min'=>6, 'max'=>20],
        'repassword' => 'require|confirm:password'
    ];

    // 提示信息
    protected $message = [
        'tel.require' => '您的用户名不能为空哦',
        'tel.regex' => '您的用户名格式不正确哦!!',
        'email.require' => '您的邮箱不能为空哦',
        'password.require' => '请输入密码',
        'password.alphaNum' => '请输入数字或字母',
        'password.min' => '密码最少有6位哦!!',
        'password.max' => '密码最多有20位哦!!',
        'repassword.require' => '两次密码不一致请重新填写'
    ];
}